using System;
using System.Windows.Forms;

using FreeFlow.Administration;

namespace FreeFlowAdministrator
{
	/// <summary>
	/// Summary description for ReportsAdaptor.
	/// </summary>
	public class ReportsAdaptor : Adaptor
	{
    private ReportCollection reports;
		public ReportsAdaptor(ReportCollection reports)
		{
      this.reports = reports;
		}

    public override string Text
    {
      get
      {
        return "Reports";
      }
    }

    public override void AddChildren(TreeNode node)
    {
      foreach (Report report in reports)
      {
        TreeNode reportNode = TreeNodeFactory.CreateTreeNode(new ReportAdaptor(report));
        node.Nodes.Add(reportNode);
      }
    }

    public override int ImageIndex
    {
      get
      {
        return 27;
      }
    }

    public override Control GetRenderer()
    {
      ReportsControl control = new ReportsControl();
      control.LoadReports(reports);
      return control;
    }

    public override object Object
    {
      get
      {
        return reports;
      }
    }
	}
}
